<template>
    <div>
        <div v-if="active==1">
            <el-table
                    :data="tableData"
                    style="width: 100%;margin-top: 50px">
                <el-table-column
                        prop="id"
                        label="序号">
                </el-table-column>
                <el-table-column
                        prop="title"
                        label="权限名称">
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button @click="showBtn(scope.row)" type="text" size="small">查看资源</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
            <el-dialog
                    :visible.sync="dialogVisible" width="400px"  >
                    <authority v-if="dialogVisible" :id="id" v-on:close="closes" ></authority>
            </el-dialog>
        </div>
</template>

<script>
    import DoctorAuthority from '../../model/ww/DoctorAuthority'

    import authority from  './authority.vue'
    const doctorAuthority = DoctorAuthority.getInstance();
    export default {
        name: "JobManage",
        data() {
            return {
                tableData: [],
                active: 1,//默认隐藏
                dialogVisible:false,
                id:'',
            }
        },
        methods: {
            list() {//查看所有权限
                doctorAuthority.list().then((response) => {
                    this.tableData = response.data.data
                })
            },
            showBtn(row){
                this.dialogVisible=true
                this.id=row.id
            },
            closes(){
                this.dialogVisible=false
            }
        },
        created() {
            this.list();
        },
        components:{
            authority
        }

    }
</script>

<style scoped>

</style>